<script setup lang="ts">
import {
  Tooltip,
  TooltipContent,
  TooltipProvider,
  TooltipTrigger,
} from '@/components/ui/tooltip'

defineProps<{
  /** # 提示内容 */
  content?: (() => VNode) | string
}>()
</script>

<template>
  <TooltipProvider>
    <Tooltip>
      <TooltipTrigger as-child>
        <slot />
      </TooltipTrigger>
      <TooltipContent>
        <slot name="content">
          <template v-if="content && typeof content === 'function'">
            {{ content() }}
          </template>
          <template v-else>
            {{ content }}
          </template>
        </slot>
      </TooltipContent>
    </Tooltip>
  </TooltipProvider>
</template>
